package com.totoro.tygeneratedragonblock.executor.command;

import com.totoro.tygeneratedragonblock.TyGenerateDragonBlock;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;

/**
 * @author Totoro
 * @version 0.1.0
 * @date 2025/8/10 - 18:40
 * @description 主要指令执行器
 **/
public interface MainCommandExecutor {
    default Boolean judgePermission(TyGenerateDragonBlock plugin, CommandSender sender, String permission) {
        boolean flag = false;
        if(null != permission) {
            flag =  sender.hasPermission(permission);
        } else {
            flag = sender.isOp();
        }
        if(!flag) {
            sender.sendMessage(plugin.getConfigManager().getConfig().getPrefix() +
                    plugin.getLanguageManager().getLanguageData().getMsg().getNoPermission());
        }
        return flag;
    }
    void execute(TyGenerateDragonBlock plugin, CommandSender sender, String[] args);
}
